<template>
  <div class="ts-alipay">
    <ts-header title="添加支付宝账号" back></ts-header>
    <ts-filed label="支付宝账号" v-model="card"></ts-filed>
    <div class="tf-save" ref="save">
      <ts-button size="large" :disabled="!card" type="primary" @click="saveCard">保存</ts-button>
    </div>
  </div>
</template>

<script>
  import {adPosition} from '../../../core/mixins'
  import {ADD_ALIPAY} from '../../../assets/js/api'

  export default {
    name: 'alipay',
    mixins: [adPosition],
    data() {
      return {
        card: ''
      }
    },
    created() {
//      let {card} = this.$route.query;
//      this.card = card || '';

    },
    methods: {
      async saveCard() {
        const json = await this.$http.post(ADD_ALIPAY, {card: this.card}, {show: true});
         console.log(json)
        if (json.result === 1) {
          let toast = this.$toast('添加成功');
          let card = this.card
          setTimeout(() => {
            this.$router.replace({path: '/manager/meansManager'})
          }, 200)
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
  .ts-alipay {
    .tf-save {
      padding: 0 .36rem;
      position: absolute;
      left: 0;
      right: 0;
      bottom: 1.12rem;
    }
  }
</style>
